<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="lib/vue-2.4.0.js"></script>
<style>
    li{
        line-height: 35px;
        padding-left: 5px;
        list-style-type: disc;
        border: 1px dashed #999;
        width: 100%;
        margin: 5px;
    }
    li:hover{
        background-color: hotpink;
        transition: all .8s ease;
    }
    .v-enter,
    .v-leave-to{
        opacity: 0;
        transform: translateY(80px)
    }
    .v-leave-active,
    .v-enter-active{
        transition: all 2s ease;

    }
    .v-move{
        transition: all .2s ease;
    }
    .v-leave-active{
        position: absolute;
    }
</style>

</head>

<body>

     <div id="app">
         <label for="" >ID:<input type="text" v-model="id"></label>
         <label for="" >Name:<input type="text" v-model="name"></label>
         <input type="button" value="添加" @click='add'>
         
          <!-- <ul> -->
              <transition-group appear tag='ul'>
                <li v-for="(item, index) in list" :key="item.id" @click='del(index)'>{{ item.id }}--{{item.name}}</li>              
              </transition-group>
          <!-- </ul> -->
        
     </div>


     <script>
        var vm = new Vue({
             el : '#app',
             data : {
                 id:'',
                 name:'',
                 list:[
                    {id:1,name:'赵高'},
                    {id:2,name:'秦桧'},
                    {id:3,name:'魏忠贤'},
                ]
            },
            methods: {
                add(){
                    this.list.push({'id':this.id,'name':this.name})
                    this.id = this.name = ''
                },
                del(i){
                    this.list.splice(i,1)
                }
            },
        }) 

     </script>

</body>

</html>